package pers.zh.parking.mvp.ui.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import pers.zh.parking.R;
import pers.zh.parking.data.entity.Notice;
import pers.zh.parking.data.entity.ParkRecord;
import pers.zh.parking.data.entity.ParkingLot;
import pers.zh.parking.data.enums.RecordStatus;
import pers.zh.parking.utils.MyUtils;
import pers.zjc.commonlibs.util.StringUtils;
import pers.zjc.commonlibs.util.TimeUtils;

public class NoticeAdapter extends BaseQuickAdapter<Notice, BaseViewHolder> {

    public NoticeAdapter(@Nullable List<Notice> data) {
        super(R.layout.rv_item_notice, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Notice item) {
        helper.setText(R.id.tvTitle, item.getNoticeTitle())
              .setText(R.id.tvDate, item.getPublishTime())
              .setText(R.id.tvContent, item.getNoticeContent());
        CardView cardView = (CardView)helper.itemView;
        if (item.isToDel()) {
            cardView.setBackgroundResource(R.drawable.bg_long_click);
        } else {
            cardView.setBackgroundResource(R.drawable.bg_no_long_click);
        }
    }

}
